<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Exports raw image pixels</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="imagick.evaluateimage.html">« Imagick::evaluateImage</a></li>
      <li style="float: right;"><a href="imagick.extentimage.html">Imagick::extentImage »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.imagick.html">Imagick</a></li>
    <li>Exports raw image pixels</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="imagick.exportimagepixels" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::exportImagePixels</h1>
  <p class="verinfo">(PECL imagick 2 &gt;=2.3.0, PECL imagick 3)</p><p class="refpurpose"><span class="refname">Imagick::exportImagePixels</span> &mdash; <span class="dc-title">Exports raw image pixels</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.exportimagepixels-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Imagick::exportImagePixels</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$x</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$y</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$width</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$height</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$map</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$STORAGE</code></span><br>): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Exports image pixels into an array. The map defines the ordering of the exported 
   pixels. The size of the returned array is <code class="literal">width * height * strlen(map)</code>.
   此方法在Imagick基于ImageMagick 6.4.7以上版本编译时可用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.exportimagepixels-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">x</code></dt>

     <dd>

      <p class="para">
       X-coordinate of the exported area
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">y</code></dt>

     <dd>

      <p class="para">
       Y-coordinate of the exported area
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">width</code></dt>

     <dd>

      <p class="para">
       Width of the exported aread
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">height</code></dt>

     <dd>

      <p class="para">
       Height of the exported area
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">map</code></dt>

     <dd>

      <p class="para">
       Ordering of the exported pixels. For example <code class="literal">&quot;RGB&quot;</code>. 
       Valid characters for the map are R, G, B, A, O, C, Y, M, K, I and P.    
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">STORAGE</code></dt>

     <dd>

      <p class="para">
       Refer to this list of <a href="imagick.constants.html#imagick.constants.pixel" class="link">pixel type constants</a>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-imagick.exportimagepixels-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an array containing the pixels values.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-imagick.exportimagepixels-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   错误时抛出 ImagickException。
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-imagick.exportimagepixels-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2764">
    <p><strong>示例 #1 Using <span class="function"><strong>Imagick::exportImagePixels()</strong></span></strong></p>
    <div class="example-contents"><p>
     Export image pixels into an array
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;Create&nbsp;new&nbsp;object&nbsp;*/<br /></span><span style="color: #0000BB">$im&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;Create&nbsp;new&nbsp;image&nbsp;*/<br /></span><span style="color: #0000BB">$im</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">newPseudoImage</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"magick:rose"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Export&nbsp;the&nbsp;image&nbsp;pixels&nbsp;*/<br /></span><span style="color: #0000BB">$pixels&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$im</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exportImagePixels</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"RGB"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">::</span><span style="color: #0000BB">PIXEL_CHAR</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Output&nbsp;*/<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$pixels</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(12) {
  [0]=&gt;
  int(72)
  [1]=&gt;
  int(64)
  [2]=&gt;
  int(57)
  [3]=&gt;
  int(69)
  [4]=&gt;
  int(59)
  [5]=&gt;
  int(43)
  [6]=&gt;
  int(124)
  [7]=&gt;
  int(120)
  [8]=&gt;
  int(-96)
  [9]=&gt;
  int(91)
  [10]=&gt;
  int(84)
  [11]=&gt;
  int(111)
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>